Skip to content

Conversation

@patjackson52
Copy link
Contributor

#38 incorrectly throwing exception when interacting on same thread.

Appears coroutines appends "@coroutine#n" to the thread name, and this can change when suspending/resuming coroutines. The solution provided in this PR strips the coroutine name from the threadname. A test that fails without stripping the suffix has been added in ThreadUtilSpec.

Long term, handling of same thread enforcement may change - perhaps wrapping store in channel or actor. For now this should work, however all interactions with the store will need to be from a singleThreadCoroutine context, such as one with Dispatchers.Main or for native - https://github.com/reduxkotlin/ReadingListSampleApp/blob/master/common/src/iosMain/kotlin/org/reduxkotlin/readinglist/common/UI.kt
@jennymolske

@patjackson52 patjackson52 merged commit 402de3e into master Feb 23, 2020
@patjackson52 patjackson52 deleted the bugfix/38-thread-confinement branch April 5, 2020 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants